<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let num2=(Math.random()*11)
        while(true){
            let num1=+prompt('请输入一个数：')
            if(num1>num2){
                alert('数字猜大了,继续猜')
            }else if(num1<num2){
                alert('数字猜小了,继续猜')
            }else{
                alert('猜对了,程序结束')
                break;
            }
        }
    </script>
</body>
</html>